Skip to content

Add self-contained AI agent harness with any OpenAI-compatible provider#9

Closed
goshitsarch-eng wants to merge 1 commit into
zerx-lab:masterfrom
goshitsarch-eng:warp-ai-agent
Closed

Add self-contained AI agent harness with any OpenAI-compatible provider#9
goshitsarch-eng wants to merge 1 commit into
zerx-lab:masterfrom
goshitsarch-eng:warp-ai-agent

Conversation

@goshitsarch-eng

Copy link
Copy Markdown

Adds a new WarpAi harness and warp-ai CLI that runs an autonomous sysadmin agent using any OpenAI-compatible API (DeepSeek, LiteLLM, Ollama, etc.) without requiring a Warp account or backend server.

Features:

  • warp-ai CLI with tool-use agent loop (run_command, read_file, write_file, list_directory) for autonomous task execution
  • WarpAiHarness ThirdPartyHarness integration that bypasses server-side prompt resolution via new requires_server_prompt_resolution() trait method
  • Default harness dropdown in Settings > Features for auto-launching warp-ai on new tabs/sessions
  • Config via env vars (WARP_AI_API_KEY, WARP_AI_BASE_URL, WARP_AI_MODEL) or ~/.config/warp-ai/config.json
  • Customizable system prompt via ~/.config/warp-ai/system-prompt.txt

Description

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Screenshots / Videos

Testing

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Adds a new WarpAi harness and warp-ai CLI that runs an autonomous
sysadmin agent using any OpenAI-compatible API (DeepSeek, LiteLLM,
Ollama, etc.) without requiring a Warp account or backend server.

Features:
- warp-ai CLI with tool-use agent loop (run_command, read_file,
  write_file, list_directory) for autonomous task execution
- WarpAiHarness ThirdPartyHarness integration that bypasses server-side
  prompt resolution via new requires_server_prompt_resolution() trait method
- Default harness dropdown in Settings > Features for auto-launching
  warp-ai on new tabs/sessions
- Config via env vars (WARP_AI_API_KEY, WARP_AI_BASE_URL, WARP_AI_MODEL)
  or ~/.config/warp-ai/config.json
- Customizable system prompt via ~/.config/warp-ai/system-prompt.txt

Co-Authored-By: Claude Opus 4.6 <noreply@openclaude.dev>
@zerx-lab

zerx-lab commented May 3, 2026

Copy link
Copy Markdown
Owner

感谢提交,但这个 PR 暂不接收,先关闭。建议先切到本仓库的 openWarp 分支了解现有实现思路,再重新提交一个目标更聚焦的 PR。

主要问题

阻塞性问题

  1. README 被整段覆盖:把 zerx-lab/warp(OpenWarp)的项目说明替换成了你个人项目的宣传页(含个人邮箱、GLM-5.1 鸣谢),这超出了"加 feature"的范围,相当于在我们仓库里做品牌替换,不能合并。
  2. 与现有 BYOP 路线重复openWarp 分支已经在做 "Bring Your Own Provider"——AISettings 里持久化模型与思考深度、DeepSeek picker、AI 配置统一走 AISettings。本 PR 又新开了一条完全独立的路径(独立 CLI、独立 ~/.config/warp-ai/config.json、独立 WARP_AI_* 环境变量),两套配置体系会互相冲突。请先看 openWarp 分支再决定如何接入。
  3. 任意 sh -c 执行 + 无审批warp_ai_clirun_command 工具直接 sh -c <cmd>,并且通过 DefaultHarness 自动在新 tab 启动,绕过了 Warp 现有的 OZ 命令审批模型。这是安全模型上的倒退。
  4. 跨平台不可用tools.rs 直接调用 shls -la,新 crate 没有 cfg(target_family) 门控。本仓库主线要发 Windows 版本(openwarp_release.yml),这样直接编不过/运行时崩。
  5. 0 测试:新增 ~700 行核心逻辑(SSE 流解析、tool-call 累积、配置解析、harness 注入),全无单测。

代码细节问题

  • crates/warp_ai_cli/src/client.rs:streaming tool-call 用 HashMap<usize, PartialToolCall> 累积,最后 into_iter().collect::<Vec>() 不保证 index 顺序——OpenAI 规范要求 tool_calls 数组顺序与 assistant message 一致,多工具调用会串位。应改为 BTreeMap 或按 index 排序。
  • client.rs SSE 缓冲:buffer = buffer[line_end + 1..].to_owned() 每行整段 clone,长流性能很差。
  • app/src/ai/agent_sdk/driver/harness/warp_ai.rs warp_ai_command():用单引号拼 sh -c 命令,temp 路径若含单引号会被注入。
  • 自动启动逻辑在 pane_group/mod.rsworkspace/view.rs 各写了一遍(default_harness.to_cli_agent() → set_pending_command + enter_agent_view_for_new_conversation),重复实现,将来必然出现行为分歧。
  • DefaultHarness 与现有 DefaultSessionMode 是两条并行设置,没有讨论优先级——比如 Mode = TabConfig 同时又设置了 default_harness 时谁生效?

唯一值得保留的设计点

ThirdPartyHarness::requires_server_prompt_resolution() 这个 trait 扩展点本身是干净的——让本地 harness 跳过 server 端 resolve_prompt() 调用。如果你愿意,可以单独提一个小 PR 只做这一项(几十行),不附带 CLI、不动 README、不改设置 UI。这样我们可以独立评估和合并。

建议的重新提交方式

  1. 拉取并阅读 openWarp 分支:了解现有 BYOP 模型如何把 provider/model/思考深度统一存在 AISettings 里。
  2. 思考你的"自带 OpenAI 兼容 provider"诉求是否能复用 openWarp 已有的 AI 配置体系,而不是新开一条 CLI + config 文件路径。
  3. 拆分 PR:trait 扩展点、Provider 接入、UI 设置、文档分别独立提交,每个都要带测试。
  4. 不要修改根目录 README.md 来宣传你的个人项目;如确有必要,可在 docs/ 下加单独文档。

期待重新提交后的方案。

@zerx-lab zerx-lab closed this May 3, 2026
@ttimasdf

ttimasdf commented May 9, 2026

Copy link
Copy Markdown

AI Slop 🤣👉

@zerx-lab

zerx-lab commented May 9, 2026

Copy link
Copy Markdown
Owner

I'll check it later, this AI is really dumb.

Repository owner deleted a comment from ttimasdf May 9, 2026
Repository owner locked and limited conversation to collaborators May 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants